package cn.tedu.rabbitmqspringboot.m1;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Producer {
    /*
    AmqpTemplate 的实例是在
    RabbitAutoConfiguration 自动配置类中创建的
     */
    @Autowired
    private AmqpTemplate t;

    public void send() {
        t.convertAndSend("helloworld", "Hello world!");
    }
}
